package sctu.edu.java.year2016.team05.lizixin.day20160615.LianXi3;

/**
 * Created by home on 2016/6/15.
 * 13.4
 */
import sctu.edu.java.year2016.team03.liyouhong.day20160607.chapter15_2.Window;

import java.awt.Container;
import java.net.URL;
import javax.swing.*;
public class MyImagelcon extends JFrame {
    public MyImagelcon (){
        Container container=getContentPane();
        JLabel jl=new JLabel("这是一个JFrame窗体",JLabel.CENTER);
        URL url=MyImagelcon.class.getResource("imageButton.jpg");//?到底该把图片放在哪里呢
        Icon icon=new ImageIcon(url);
        jl.setIcon(icon);
        jl.setHorizontalAlignment(SwingConstants.CENTER);
        jl.setOpaque(true);
        container.add(jl);
        setSize(250, 100);
        setVisible(true);
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

    }

    public static void main(String[] args) {
        new MyImagelcon();
    }
}
